🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / konsist / src / jvmTest / kotlin / org / meshtastic / core / konsist / ProjectPath.kt
Displaying Raw • Download
core/konsist/src/jvmTest/kotlin/org/meshtastic/core/konsist/ProjectPath.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 2.48 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.konsist
Tff7b72import T7ee787com.lemonappdev.konsist.api.declaration.KoFileDeclaration
T8b949e/** Makes project-relative path rules independent of the host filesystem separator. */
Tff7b72internal Tff7b72fun Te6edf3StringTb4b4b4.Td2a8ffnormalizedProjectPathTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657String Tff7b72= Te6edf3replaceTb4b4b4(Ta5d6ff'\\'Tb4b4b4, Ta5d6ff'/'Tb4b4b4)
T8b949e/**
* Path relative to the checkout being scanned, e.g. `/core/ble/src/commonMain/kotlin/…`.
*
* Every path rule here must key off this rather than the absolute [KoFileDeclaration.path]: agent sessions run from
* worktrees under `<main checkout>/.claude/worktrees/<name>`, so an absolute path carries `.claude` for every file in
* the checkout.
*/
Tff7b72internal Tff7b72val Te6edf3KoFileDeclarationTb4b4b4.Te6edf3scanPathTb4b4b4: Tffa657String
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3projectPathTb4b4b4.Te6edf3normalizedProjectPathTb4b4b4(Tb4b4b4)
T8b949e/**
* A file belonging to an agent worktree nested inside the checkout being scanned.
*
* `scopeFromProject` sweeps `<root>/.claude/worktrees/` too, and stale copies there resurface long-fixed lines as
* phantom offenders. This matches only at the root of the scanned checkout, so a scan that itself runs from a worktree
* still sees its own sources.
*/
Tff7b72internal Tff7b72fun Te6edf3KoFileDeclarationTb4b4b4.Td2a8ffisNestedAgentWorktreeTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Boolean Tff7b72= Te6edf3scanPathTb4b4b4.Te6edf3removePrefixTb4b4b4(Ta5d6ff"Ta5d6ff/Ta5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3startsWithTb4b4b4(Ta5d6ff"Ta5d6ff.claude/Ta5d6ff"Tb4b4b4)
T8b949e/**
* Failure message for a scope that matched nothing.
*
* Names the historical cause up front: a too-broad `.claude` exclusion silently emptied the whole scan for worktree
* sessions, and the empty result is the only symptom.
*/
Tff7b72internal Tff7b72fun Td2a8ffemptyScanMessageTb4b4b4(Te6edf3scopeDescriptionTb4b4b4: Tffa657StringTb4b4b4)Tb4b4b4: Tffa657String Tff7b72=
Ta5d6ff"Tffd700$Te6edf3scopeDescriptionTa5d6ff matched no files at all, so this rule verified nothing. Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6ffCheck the path filters in ProjectPath.kt — an exclusion that matches the whole checkout (rather than a Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6ffdirectory relative to its root) empties the scan without any other symptom.Ta5d6ff"
Served by rngit 1.5.0 - Generated in 0.04s